import React, { useState } from 'react';
import { axconst } from '@/shared/axconst';
import { AxStandardWideList } from '@/components/AxList/AxStandardWideList';
import Search from './components/search';
import Material from './components/material';

const Index: React.FC<any> = props => {
  const [expandedRowKeys, setExpandedRowKeys] = useState(['1']);
  /** 配置列 */
  const columns = [
    {
      title: '申请人',
      dataIndex: 'receiver',
      width: axconst.width.threeonly,
    },
    {
      title: '申请人电话',
      dataIndex: 'phone',
      width: axconst.width.phone,
    },
    {
      title: '状态',
      dataIndex: 'checkStatus',
      width: axconst.width.fouronly,
    },
    {
      title: '申请时间',
      dataIndex: 'receiveTime',
      width: axconst.width.time,
    },
    {
      title: '申请备注',
      dataIndex: 'remark',
      width: axconst.width.remark,
    },
  ];

  const handleExpandedRowsChange = (expandedRows: any) => {
    setExpandedRowKeys(expandedRows);
  };

  return (
    <>
      <AxStandardWideList
        columns={columns}
        data={{...axconst.data}}
        checkboxModel={false}
        AdvancedSearch={Search}
        expandedRowKeys={expandedRowKeys}
        onExpandedRowsChange={handleExpandedRowsChange}
        expandedRowRender={(record: any) => (
          <Material />
        )}
      />
    </>
  );
};

export default Index;
